package iko.mantianx.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author starrysky
 * @title: HelloController
 * @projectName springMvc_Parent
 * @description: TODO
 * @date 2021/2/420:48
 */
public class HelloController implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
//        ModelAndView模型和视图
        ModelAndView modelAndView = new ModelAndView();
//        封装对象，放在ModelAndView中，Model
        modelAndView.addObject("msg","Spring-MVC!11");
//        封装要跳转的视图，放在ModelAndView中，和/WEB-INFO/jsp/hellomvc.jsp
        modelAndView.setViewName("hellomvc");

        return modelAndView;
    }
}
